/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H

#define __ALIGN .align 0
#define __ALIGN_STR ".align 0"

#define ENDPROC(name) \
  .type name, %function; \
  END(name)

#ifdef CONFIG_RTOS_SOFTWARE_CFI
#define RTOS_CFI_TAG		.long CONFIG_RTOS_CFI_TAG
#define	TAG_SWAP(l) \
	(((l) >> 24) | \
	(((l) & 0x00ff0000) >> 8) | \
	(((l) & 0x0000ff00) << 8) | \
	((l) << 24))
#ifdef __ARMEB__
#define RTOS_CFI_TAG_VALUE	TAG_SWAP(CONFIG_RTOS_CFI_TAG)
#else
#define RTOS_CFI_TAG_VALUE	CONFIG_RTOS_CFI_TAG
#endif /* __ARMEB__ */
#define RTOS_CFI_ALIGN(bits)  .p2alignl (bits), RTOS_CFI_TAG_VALUE
#define RTOS_CFI_TAG_ALIGN(bits) \
	.align 2; \
	RTOS_CFI_TAG; \
	RTOS_CFI_ALIGN(bits)
#else
#define RTOS_CFI_TAG_ALIGN(bits)  .align (bits)
#endif /* CONFIG_RTOS_SOFTWARE_CFI */
#endif
